<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
    	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	    <title>发货月报表</title>
	    <meta name="description" content="防伪溯源">
	    <link rel="stylesheet" href="css/AllStyle.css" />
	    <link rel="stylesheet" href="css/iconfont.css" />
	    <script type="text/javascript" src="js/common.js" ></script>
	    <script type="text/javascript" src="js/companydata.js" ></script>
	    <script type="text/javascript" src="js/data.js" ></script>
	    <script type="text/javascript" src="js/tmpl.js" ></script>
	</head>
	<body>
		<!-- 页头 -->
	    <section>
		    <script type="text/javascript">
		        AllPageHeader()
		    </script>
	    </section>
	    
	    <!-- 页面  -->
	    <section class="AllContent" style="background-color: #fff;">
	    	
	    	<div class="dataNavli">
	    		<ul>
	    			<li class="dayStatistics">日报表</li>
	    			<li class="monthStatistics">月报表</li>
	    		</ul>
	    	</div>
	    	
	    	<img id="LoadingImg" style="width: 40%;margin:20px auto;display:block;" src="images/loading5.gif" />
	    	
	    	<div style="width:100%;height:360px;overflow-x: auto;overflow-y: hidden;padding-bottom:5px;"><div id="main" style="position:relative;width:100%;min-width:1000px;height:400px;margin-top: -40px;"></div></div>
	    	
    		<!-- 信息 -->
			<div class="dataNav">
				<ul>
					<li>日期</li>
					<li>数量</li>
				</ul>
			</div>
				
			<div id="datalist">

            </div>
	    	
	    </section>
	</body>
	<script type="text/javascript" src="js/jquery.min.js" ></script>
	<script type="text/javascript" src="js/mui.min.js" ></script>
	<script type="text/javascript" src="js/echarts.min.js" ></script>
	<script type="text/javascript">
	
		$('.dayStatistics').on('tap',function(){
			window.location.href= 'ConsignmentReport.html';
		})

        function GetDateStr(AddDayCount) {
            var dd = new Date();
            dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
            var y = dd.getFullYear();
            var m = dd.getMonth()+1;//获取当前月份的日期
            var d = dd.getDate();
            return y+"-"+m+"-"+d;
        }
        datas = new Array();
        dates = new Array();
        
        $(function () {
			$('.AllHeader li:eq(0)').removeClass('mui-action-back mui-pull-left').addClass('tiaozhuan');
			$('.AllHeader li:eq(1)').text('发货月报表')
			$('.tiaozhuan').on('tap',function(){
				plus.webview.getWebviewById('ConsignmentReport.html').close();
				window.location.href= 'supper.html';
			});
        	
        	$('.dataNavli ul li').css({color:'#999',borderBottom:'none'});
        	$('.dataNavli ul li:eq(1)').css({color:'#0088CC',borderBottom:'1px solid #00aafa'});
        	
        	var myChart = echarts.init(document.getElementById('main'));
        	
            $.ajax({
                type: "post",
                url:getServerUrl()+"/Open/ComStat/monthstat",
                dataType: 'json',
                data:'access_token='+getToken(),
                success: function (json) {
                    if (json.result == "1") {
                        var clist = json.data;
                        var chtml = ''
                        if (!empty(clist)) {
                            for (var i = 0; i < clist.length; i++) {
                                if (!empty(clist[i])) {
                                	chtml = chtml +'<ul>'
												  +'<li>' + clist[i].m + '</li>'
												  +'<li>' + clist[i].num + '</li>'
												  +'</ul>';
                                    datas.push(clist[i].num);
                                    dates.push(clist[i].m);
                                }
                            }
                        }
                        $("#datalist").append(chtml);
                        $('#LoadingImg').hide();
                        
                        option = {
						    tooltip: {
						        trigger: 'axis'
						    },
						    grid: {
						        left: '3%',
						        right: '4%',
						        bottom: '3%',
						        containLabel: true
						    },
						    xAxis: {
						        type : 'category',
                                boundaryGap : false,
                                data :dates
						    },
						    yAxis: {
						        type: 'value'
						    },
						    series: [
						    	{
                                    name:'发货量',
                                    type:'line',
                                    stack: '总量',
                                    data:datas
                                }
						    ]
						};
			        	myChart.setOption(option);
                        
                    }
                }
            });
        });
        function onDeviceReady() {
            document.addEventListener("backbutton", onBackKeyDown, false);
        }
        function onBackKeyDown() {
            openUrl("login.html");
        }
	</script>
</html>
